library(readxl)
mydata <- read_xlsx("./Midterm.xlsx")
mydata <- as.data.frame(mydata)
head(mydata, 3)
## ID Points Group
## 1 1 9.0 1
## 2 2 9.0 1
## 3 3 7.5 1
Description:
mydata$GroupF <- factor(mydata$Group,
levels = c(1, 2),
labels = c("English", "Slovenian"))
head(mydata, 3)
## ID Points Group GroupF
## 1 1 9.0 1 English
## 2 2 9.0 1 English
## 3 3 7.5 1 English
library(ggplot2)
Eng <- ggplot(mydata[mydata$GroupF == "English", ], aes(x = Points)) +
theme_linedraw() +
geom_histogram(binwidth = 2, colour = "black", fill = "darkred") +
ylab("Frequency") +
ggtitle("English course") +
scale_x_continuous(breaks = c(1:15),
limits = c(0, 16))
Slo <- ggplot(mydata[mydata$GroupF == "Slovenian", ], aes(x = Points)) +
theme_linedraw() +
geom_histogram(binwidth = 2, colour = "black", fill = "darkblue") +
ylab("Frequency") +
ggtitle("Slovenian course") +
scale_x_continuous(breaks = c(1:15),
limits = c(0, 16))
library(ggpubr)
ggarrange(Eng, Slo,
ncol = 2, nrow = 1)
## Warning: Removed 2 rows containing missing values or values outside the scale
## range (`geom_bar()`).
## Removed 2 rows containing missing values or values outside the scale
## range (`geom_bar()`).
library(dplyr)
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:car':
##
## recode
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(rstatix)
##
## Attaching package: 'rstatix'
## The following object is masked from 'package:stats':
##
## filter
mydata %>%
group_by(GroupF) %>%
shapiro_test(Points)
## # A tibble: 2 × 4
## GroupF variable statistic p
## <fct> <chr> <dbl> <dbl>
## 1 English Points 0.972 0.416
## 2 Slovenian Points 0.962 0.101
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
## The following object is masked from 'package:car':
##
## logit
describeBy(mydata$Points, mydata$GroupF)
##
## Descriptive statistics by group
## group: English
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 40 8.93 2.92 9 9 2.22 1.5 15 13.5 -0.26 -0.1
## se
## X1 0.46
## ----------------------------------------------------
## group: Slovenian
## vars n mean sd median trimmed mad min max range skew kurtosis
## X1 1 51 9.18 2.5 9 9.15 2.22 3 15 12 0.1 0.12
## se
## X1 0.35
library(car)
leveneTest(mydata$Points, mydata$GroupF)
## Levene's Test for Homogeneity of Variance (center = median)
## Df F value Pr(>F)
## group 1 0.8523 0.3584
## 89
t.test(mydata$Points ~ mydata$GroupF,
var.equal = TRUE,
alternative = "two.sided")
##
## Two Sample t-test
##
## data: mydata$Points by mydata$GroupF
## t = -0.44187, df = 89, p-value = 0.6597
## alternative hypothesis: true difference in means between group English and group Slovenian is not equal to 0
## 95 percent confidence interval:
## -1.3822629 0.8793217
## sample estimates:
## mean in group English mean in group Slovenian
## 8.925000 9.176471
library(effectsize)
##
## Attaching package: 'effectsize'
## The following object is masked from 'package:psych':
##
## phi
## The following objects are masked from 'package:rstatix':
##
## cohens_d, eta_squared, omega_squared
effectsize::cohens_d(mydata$Points ~ mydata$GroupF,
pooled_sd = TRUE)
## Cohen's d | 95% CI
## -------------------------
## -0.09 | [-0.51, 0.32]
##
## - Estimated using pooled SD.
library(effectsize)
interpret_cohens_d(0.09, rules = "sawilowsky2009")
## [1] "tiny"
## (Rules: sawilowsky2009)